package com.wimcorp.magic.abilities;

import java.rmi.RemoteException;

import javax.persistence.Entity;
import javax.persistence.Table;

import com.wimcorp.magic.abilities.trigger.AbilityTrigger;
import com.wimcorp.magic.exception.CastException;
import com.wimcorp.magic.input.Target;

/**
 * example {target: 'SELF'}
 * 
 * target options : SELF,OPPONENT
 * 
 */
@Entity
@Table(name = "revealhand", schema = "abilities")
public class RevealHand extends Ability {

	public RevealHand() {

	}

	public RevealHand(AbilityTrigger trigger) {
		super(trigger);
	}

	public RevealHand(RevealHand ability) {
		super(ability);
	}

	public void cast() throws Exception {

		switch (getTarget()) {
		case SELF:
			getPlayer().getUserInterface().message("You reveal your hand. ");
			getPlayer().getOpponent().getUserInterface()
					.message(String.format("%s reveals hand : \n%s. ",getPlayer().getName(),getPlayer().getHand()));
			break;
		case OPPONENT:
			getPlayer().getOpponent().getUserInterface().message("You reveal your hand. ");
			getPlayer().getUserInterface().message(String.format(
					"%s reveals hand : \n%s",getPlayer().getOpponent().getName(),getPlayer().getOpponent().getHand()));
			break;
		}
	}

	@Override
	protected void executeAbility() throws CastException {

	}

	@Override
	public RevealHand clone() {
		return new RevealHand(this);
	}

}
